using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.IO;
using System.Diagnostics;
using System.Collections;

namespace TXTextControl.Tools.CAS
{
    public partial class frm_dialog : Form
    {
        private SecuritySettings newSettings = new SecuritySettings();

        public frm_dialog()
        {
            InitializeComponent();

            // Security Settings
            newSettings.MembershipUrl = @"http://www.textcontrol.com/*";
            newSettings.RedirectUrl = @"http://www.textcontrol.com";
            newSettings.Publisher = "The Imaging Source Europe GmbH";
            newSettings.Name = "TX Text Control .NET Server";
            newSettings.Description = "Security settings for TX Text Control .NET Server";
            newSettings.Permission = PermissionSet.FullTrust;

            lbl_url_content.Text = newSettings.MembershipUrl;
            lbl_publisher.Text = newSettings.Publisher;
        }

        private void btn_run_Click(object sender, EventArgs e)
        {
            lbl_wait.Text = "Please wait...";
            lbl_wait.Update();

            try
            {
                newSettings.Patch();
                newSettings.RestartIE();
                Close();
            }
            catch (Exception exc)
            {
                lbl_wait.Text = exc.Message;
                lbl_wait.Update();
                btn_cancel.Text = "Close";
                btn_run.Enabled = false;
            }
        }

        private void btn_cancel_Click(object sender, EventArgs e)
        {
            Close();
        }


    }
}